<template>
	<view>
		<uni-card
				v-for="(item, index) in goodsInfo"
				:key="item.index"
		    :title="item.info"
		    mode="style"
		    :is-shadow="true"
		    :note="item.number"
				:stock="item.order_status"
				:size="item.pay_type"
		>
		商品名称: {{ item.commodity_name }}
		</uni-card>
	</view>
</template>

<script>
	import uniCard from "@/components/uni-card/uniOrderInfo-card"
	
	export default {
		components: { uniCard, prompt },
		data() {
			return {
				goodsInfo: [],
			}
		},
		onLoad(option) {
			console.log(option.order_no)
			let params = {
				page: 1,
				limit: 10,
				orderNo: option.order_no
			};
			this.init(params);
		},
		methods: {
			init(params) {
				this.$api.selectOrderOrItem(params).then((res) => {
					res.rows.forEach(item => {
						if (item.order_status == 0) {
							item.order_status = '交易中'
						} else if (item.order_status == 1) {
							item.order_status = '交易成功'
						} else if (item.order_status == -1) {
							item.order_status = '交易失败'
						} else if (item.order_status == 2) {
							item.order_status = '取消订单'
						}
						if (item.pay_type == 0) {
							item.pay_type = '线下支付'
						} else if (item.pay_type == 1) {
							item.pay_type = '线上支付'
						}
					})
					this.goodsInfo = res.rows
				}).catch((err) => {
					console.log('request fail', err);
				})
			}
		}
	}
</script>

<style>
</style>
